import { getMenuServices } from '@/services/menuServices'

const menu = {
  namespaced:true,
  state: {
    menuList:[]
  },
  mutations: {
    setMenuList(state,payload){
      state.menuList = payload
    }
  },
  actions:{
    async getMenuAction({payload,commit}){
      try {
        let res = await getMenuServices(payload)
        if(res.code === 0){
          console.log(res)
          commit('setMenuList',res.data.list)

        }
      }catch (e) {
        console.log(e)
      }

    }
  },
  getters: {
    getMenuList(state){
      return state.menuList
    }
  }
}

export default menu